home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / PL 2.0 SupplementDoc Folder.sit / PL 2.0 SupplementDoc Folder / Documentation / Chapter 24. Errors < prev    next >
Text File  |  1995-03-28  |  28KB  |  617 lines

  1. Common Lisp the Language, 2nd Edition
  2. -------------------------------------------------------------------------------
  3.  
  4. 24. Errors
  5.  
  6. Errors may be signaled for a variety of reasons. Many built-in Common Lisp
  7. functions may signal an error when given incorrect arguments. Other functions,
  8. described in this chapter, may be called by user programs for the purpose of
  9. signaling an error.
  10.  
  11. When an error is signaled, it is handled in an implementation-dependent way. It
  12. is expected that each implementation of Common Lisp will provide an interactive
  13. debugger that prints the error message along with suitable contextual
  14. information such as which function detected the error. The user may interact
  15. with the debugger to examine or modify the state of the program in various
  16. ways, including abandoning the current computation (``aborting to top level'')
  17. and continuing from the error. What ``continuing'' means depends on how the
  18. error is signaled; the details of this are specified below for each
  19. error-signaling function.
  20.  
  21. [old_change_begin]
  22. An implementation may also choose to provide means (such as the errset special
  23. form in MacLisp) for a program to trap all errors and prevent the debugger from
  24. stepping in for certain errors.
  25.  
  26. -------------------------------------------------------------------------------
  27. Rationale: Error handling of adequate flexibility and power for all systems
  28. written in Common Lisp appears to require a complex error classification
  29. system. Experience with several error-handling systems in such dialects as
  30. MacLisp and Lisp Machine Lisp indicates that further experimentation is needed
  31. in this area; it is too early to define a standard error-handling mechanism.
  32. Therefore Common Lisp provides standard ways to signal errors, but no standard
  33. ways to handle errors. Of course a complete Lisp system requires error-handling
  34. mechanisms, but many useful portable programs do not require them. It is
  35. expected that a future revision of Common Lisp will address the problem of
  36. portable error-handling mechanisms.
  37. -------------------------------------------------------------------------------
  38.  
  39. [old_change_end]
  40.  
  41. [change_begin]
  42. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  43. Lisp Condition System. This was the result of the research and experimentation
  44. alluded to in the preceding paragraph. Conditions subsume and generalize the
  45. notion of errors. The condition system also provides means for handling
  46. conditions (of which errors are a special case) and for restarting a
  47. computation after a condition has been signaled. See chapter 29.
  48. [change_end]
  49.  
  50. -------------------------------------------------------------------------------
  51. Compatibility note: What is here called ``continuing,'' Lisp Machine Lisp calls
  52. ``proceeding'' from an error.
  53.  
  54. [change_begin]
  55. In the new terminology introduced in chapter 29, what Lisp Machine Lisp called
  56. ``proceeding'' would be called ``restarting,'' and ``continuing'' refers to the
  57. particular restart named continue.
  58. [change_end]
  59. -------------------------------------------------------------------------------
  60.  
  61. -------------------------------------------------------------------------------
  62.  
  63.    *  General Error-Signaling Functions
  64.    *  Specialized Error-Signaling Forms and Macros
  65.    *  Special Forms for Exhaustive Case Analysis
  66.  
  67. -------------------------------------------------------------------------------
  68.  
  69. 24.1. General Error-Signaling Functions
  70.  
  71. The functions in this section provide various mechanisms for signaling
  72. warnings, breaks, continuable errors, and fatal errors.
  73.  
  74. In each case, the caller specifies an error message (a string) that may be
  75. processed (and perhaps displayed to the user) by the error-handling mechanism.
  76. All messages are constructed by applying the function format to the quantities
  77. nil, format-string, and all the args to produce a string.
  78.  
  79. An error message string should not contain a newline character at either the
  80. beginning or end, and should not contain any sort of herald indicating that it
  81. is an error. The system will take care of these according to whatever its
  82. preferred style may be.
  83.  
  84. Conventionally, error messages are complete English sentences ending with a
  85. period. Newlines in the middle of long messages are acceptable. There should be
  86. no indentation after a newline in the middle of an error message. The error
  87. message need not mention the name of the function that signals the error; it is
  88. assumed that the debugger will make this information available.
  89.  
  90. -------------------------------------------------------------------------------
  91. Implementation note: If the debugger in a particular implementation displays
  92. error messages indented from the prevailing left margin (for example, indented
  93. by seven spaces because they are prefixed by the seven-character herald
  94. ``Error: ''), then the debugger should take care of inserting the appropriate
  95. indentation into a multi-line error message. Similarly, a debugger that
  96. prefixes error messages with semicolons so that they appear to be comments
  97. should take care of inserting a semicolon at the beginning of each line in a
  98. multi-line error message. These rules are suggested because, even within a
  99. single implementation, there may be more than one program that presents error
  100. messages to the user, and they may use different styles of presentation. The
  101. caller of error cannot anticipate all such possible styles, and so it is
  102. incumbent upon the presenter of the message to make any necessary adjustments.
  103. -------------------------------------------------------------------------------
  104.  
  105. Common Lisp does not specify the manner in which error messages and other
  106. messages are displayed. For the purposes of exposition, a fairly simple style
  107. of textual presentation will be used in the examples in this chapter. The
  108. character > is used to represent the command prompt symbol for a debugger.
  109.  
  110. [Function]
  111. error format-string &rest args
  112.  
  113. [old_change_begin]
  114. This function signals a fatal error. It is impossible to continue from this
  115. kind of error; thus error will never return to its caller.
  116.  
  117. The debugger printout in the following example is typical of what an
  118. implementation might print when error is called. Suppose that the (misspelled)
  119. symbol emergnecy-shutdown has no property named command (all too likely, as it
  120. is probably a typographical error for emergency-shutdown).
  121.  
  122. (defun command-dispatch (cmd)
  123.   (let ((fn (get cmd 'command)))
  124.     (if (not (null fn))
  125.         (funcall fn))
  126.         (error "The command ~S is unrecognized." cmd))))
  127.  
  128. (command-dispatch 'emergnecy-shutdown)
  129. Error: The command EMERGNECY-SHUTDOWN is unrecognized.
  130. Error signaled by function COMMAND-DISPATCH.
  131.  
  132.  
  133. [old_change_end]
  134.  
  135. [change_begin]
  136. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  137. Lisp Condition System. This proposal modifies the definition of error to
  138. specify its interaction with the condition system. See section 29.4.1.
  139. [change_end]
  140.  
  141. -------------------------------------------------------------------------------
  142. Compatibility note: Lisp Machine Lisp calls this function ferror. MacLisp has a
  143. function named error that takes different arguments and can signal either a
  144. fatal or a continuable error.
  145. -------------------------------------------------------------------------------
  146.  
  147. [Function]
  148. cerror continue-format-string error-format-string &rest args
  149.  
  150. [old_change_begin]
  151. cerror is used to signal continuable errors. Like error, it signals an error
  152. and enters the debugger. However, cerror allows the program to be continued
  153. from the debugger after resolving the error.
  154.  
  155. If the program is continued after encountering the error, cerror returns nil.
  156. The code that follows the call to cerror will then be executed. This code
  157. should correct the problem, perhaps by accepting a new value from the user if a
  158. variable was invalid.
  159.  
  160. If the code that corrects the problem interacts with the program's use and
  161. might possibly be misled, it should make sure the error has really been
  162. corrected before continuing. One way to do this is to put the call to cerror
  163. and the correction code in a loop, checking each time to see if the error has
  164. been corrected before terminating the loop.
  165.  
  166. The continue-format-string argument, like the error-format-string argument, is
  167. given as a control string to format along with the args to construct a message
  168. string. The error message string is used in the same way that error uses it.
  169. The continue message string should describe the effect of continuing. The
  170. intent is that this message can be displayed as an aid to the user in deciding
  171. whether and how to continue. For example, it might be used by an interactive
  172. debugger as part of the documentation of its ``continue'' command.
  173.  
  174. The content of the continue message should adhere to the rules of style for
  175. error messages. It should not include any statement of how the ``continue''
  176. command is given, since this may be different for each debugger. (It is up to
  177. the debugger to supply this information according to its own particular style
  178. of presentation and user interaction.)
  179. [old_change_end]
  180.  
  181. [change_begin]
  182. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  183. Lisp Condition System. This proposal modifies the definition of cerror to
  184. specify its interaction with the condition system. See section 29.4.1.
  185. [change_end]
  186.  
  187. Here is an example where the caller of cerror, if continued, fixes the problem
  188. without any further user interaction:
  189.  
  190. (let ((nvals (list-length vals)))
  191.   (unless (= nvals 3)
  192.     (cond ((< nvals 3)
  193.            (cerror "Assume missing values are zero."
  194.                    "Too few values in ~S;~%~
  195.                     three are required, ~
  196.                     but ~R ~:[were~;was~] supplied."
  197.                    nvals (= nvals 1))
  198.            (setq vals (append vals (subseq '(0 0 0) nvals))))
  199.           (t (cerror "Ignore all values after the first three."
  200.                      "Too many values in ~S;~%~
  201.                       three are required, ~
  202.                       but ~R were supplied."
  203.                       nvals)
  204.              (setq vals (subseq vals 0 3))))))
  205.  
  206. If vals were the list (-47), the interaction might look like this:
  207.  
  208. Error: Too few values in (-47);
  209.        three are required, but one was supplied.
  210. Error signaled by function EXAMPLE.
  211. If continued: Assume missing values are zero.
  212.  
  213.  
  214. In this example, a loop is used to ensure that a test is satisfied. (This
  215. example could be written more succinctly using assert or check-type, which
  216. indeed supply such loops.)
  217.  
  218. (do ()
  219.     ((known-wordp word) word)
  220.   (cerror "You will be prompted for a replacement word."
  221.           "~S is an unknown word (possibly misspelled)."
  222.           word)
  223.   (format *query-io* "~&New word: ")
  224.   (setq word (read *query-io*)))
  225.  
  226. In complex cases where the error-format-string uses some of the args and the
  227. continue-format-string uses others, it may be necessary to use the format
  228. directives ~* and ~@* to skip over unwanted arguments in one or both of the
  229. format control strings.
  230.  
  231. -------------------------------------------------------------------------------
  232. Compatibility note: The Lisp Machine Lisp function fsignal is similar to this,
  233. but returns :no-action rather than nil, and fails to distinguish between the
  234. error message and the continue message.
  235. -------------------------------------------------------------------------------
  236.  
  237. [Function]
  238. warn format-string &rest args
  239.  
  240. [old_change_begin]
  241. warn prints an error message but normally doesn't go into the debugger.
  242. (However, this may be controlled by the variable *break-on-warnings*.)
  243. [old_change_end]
  244.  
  245. [change_begin]
  246. X3J13 voted in March 1989 (BREAK-ON-WARNINGS-OBSOLETE)   to remove
  247. *break-on-warnings* from the language. See *break-on-signals*.
  248. [change_end]
  249.  
  250. [old_change_begin]
  251. warn returns nil.
  252.  
  253. This function would be just the same as format with the output directed to the
  254. stream in error-output, except that warn may perform various
  255. implementation-dependent formatting and other actions. For example, an
  256. implementation of warn should take care of advancing to a fresh line before and
  257. after the error message and perhaps supplying the name of the function that
  258. called warn.
  259. [old_change_end]
  260.  
  261. -------------------------------------------------------------------------------
  262. Compatibility note: The Lisp Machine Lisp function compiler:warn is an
  263. approximate equivalent to this.
  264. -------------------------------------------------------------------------------
  265.  
  266. [change_begin]
  267. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  268. Lisp Condition System. This proposal modifies the definition of warn to specify
  269. its interaction with the condition system. See section 29.4.9.
  270. [change_end]
  271.  
  272. [old_change_begin]
  273.  
  274. [Variable]
  275. *break-on-warnings*
  276.  
  277. If *break-on-warnings* is not nil, then the function warn behaves like break.
  278. It prints its message and then goes to the debugger or break loop. Continuing
  279. causes warn to return nil. This flag is intended primarily for use when the
  280. user is debugging programs that issue warnings; in ``production'' use, the
  281. value of *break-on-warnings* should be nil.
  282. [old_change_end]
  283.  
  284. [change_begin]
  285. X3J13 voted in March 1989 (BREAK-ON-WARNINGS-OBSOLETE)   to remove
  286. *break-on-warnings* from the language. See *break-on-signals*.
  287. [change_end]
  288.  
  289. [Function]
  290. break &optional format-string &rest args
  291.  
  292. [old_change_begin]
  293. break prints the message and goes directly into the debugger, without allowing
  294. any possibility of interception by programmed error-handling facilities. (Right
  295. now, there aren't any error-handling facilities defined in Common Lisp, but
  296. there might be in particular implementations, and there will be some defined by
  297. Common Lisp in the future.) When continued, break returns nil. It is
  298. permissible to call break with no arguments; a suitable default message will be
  299. provided.
  300.  
  301. break is presumed to be used as a way of inserting temporary debugging
  302. ``breakpoints'' in a program, not as a way of signaling errors; it is expected
  303. that continuing from a break will not trigger any unusual recovery action. For
  304. this reason, break does not take the additional format control string argument
  305. that cerror takes. This and the lack of any possibility of interception by
  306. programmed error handling are the only program-visible differences between
  307. break and cerror. The interactive debugger may choose to display them
  308. differently; for instance, a cerror message might be prefixed with the herald
  309. ``Error: '' and a break message with ``Break: ''. This depends on the
  310. user-interface style of the particular implementation. A particular
  311. implementation may choose, according to its own style and needs, when break is
  312. called to go into a debugger different from the one used for handling errors.
  313. For example, it might go into an ordinary read-eval-print loop identical to the
  314. top-level one except for the provision of a ``continue'' command that causes
  315. break to return nil.
  316. [old_change_end]
  317.  
  318. -------------------------------------------------------------------------------
  319. Compatibility note: In MacLisp, break is a special form (FEXPR) that takes two
  320. optional arguments. The first is a symbol (it would be a string if MacLisp had
  321. strings), which is not evaluated. The second is evaluated to produce a truth
  322. value specifying whether break should break (true) or return immediately
  323. (false). In Common Lisp one makes a call to break conditional by putting it
  324. inside a conditional form such as when or unless.
  325. -------------------------------------------------------------------------------
  326.  
  327. [change_begin]
  328. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  329. Lisp Condition System. This proposal modifies the definition of break to
  330. specify its interaction with the condition system. See section 29.4.11.
  331. [change_end]
  332.  
  333. -------------------------------------------------------------------------------
  334.  
  335. 24.2. Specialized Error-Signaling Forms and Macros
  336.  
  337. These facilities are designed to make it convenient for the user to insert
  338. error checks into code.
  339.  
  340. [Macro]
  341. check-type place typespec [string]
  342.  
  343. [old_change_begin]
  344. check-type signals an error if the contents of place are not of the desired
  345. type. Upon continuing from this error, the user will be asked for a new value;
  346. check-type will store the new value in place and start over, checking the type
  347. of the new value and signaling another error if it is still not of the desired
  348. type. Subforms of place may be evaluated multiple times because of the implicit
  349. loop generated. check-type returns nil.
  350.  
  351. The place must be a generalized variable reference acceptable to setf. The
  352. typespec must be a type specifier; it is not evaluated. The string should be an
  353. English description of the type, starting with an indefinite article (``a'' or
  354. ``an''); it is evaluated. If string is not supplied, it is computed
  355. automatically from typespec. (The optional string argument is allowed because
  356. some applications of check-type may require a more specific description of what
  357. is wanted than can be generated automatically from the type specifier.)
  358.  
  359. The error message will mention place, its contents, and the desired type.
  360. [old_change_end]
  361.  
  362. [change_begin]
  363. The precise format and content of the error message is
  364. implementation-dependent. The example shown below is representative of current
  365. practice.
  366. [change_end]
  367.  
  368. -------------------------------------------------------------------------------
  369. Implementation note: An implementation may choose to generate a somewhat
  370. differently worded error message if it recognizes that place is of a particular
  371. form, such as one of the arguments to the function that called check-type.
  372. -------------------------------------------------------------------------------
  373.  
  374. [change_begin]
  375. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  376. Lisp Condition System. This proposal modifies the definition of check-type to
  377. specify its interaction with the condition system. See section 29.4.2.
  378.  
  379. X3J13 voted in March 1988 (PUSH-EVALUATION-ORDER)   to clarify order of
  380. evaluation (see section 7.2).
  381. [change_end]
  382.  
  383. Examples:
  384.  
  385. (setq aardvarks '(sam harry fred))
  386. (check-type aardvarks (vector integer))
  387. Error: The value of AARDVARKS, (SAM HARRY FRED),
  388.        is not a vector of integers.
  389.  
  390. (setq naards 'foo)
  391. (check-type naards (integer 0 *) "a positive integer")
  392. Error: The value of NAARDS, FOO, is not a positive integer.
  393.  
  394. -------------------------------------------------------------------------------
  395. Compatibility note: In Lisp Machine Lisp the equivalent facility is called
  396. check-arg-type.
  397. -------------------------------------------------------------------------------
  398.  
  399. [Macro]
  400. assert test-form [({place}*) [string {arg}*]]
  401.  
  402. [old_change_begin]
  403. assert signals an error if the value of test-form is nil. Continuing from this
  404. error will allow the user to alter the values of some variables, and assert
  405. will then start over, evaluating test-form again. assert returns nil.
  406.  
  407. test-form is any form. Each place (there may be any number of them, or none)
  408. must be a generalized-variable reference acceptable to setf. These should be
  409. variables on which test-form depends, whose values may sensibly be changed by
  410. the user in attempting to correct the error. Subforms of each place are only
  411. evaluated if an error is signaled, and may be re-evaluated if the error is
  412. re-signaled (after continuing without actually fixing the problem).
  413.  
  414. The string is an error message string, and the args are additional arguments;
  415. they are evaluated only if an error is signaled, and re-evaluated if the error
  416. is signaled again. The function format is applied in the usual way to string
  417. and args to produce the actual error message. If string is omitted (and
  418. therefore also the args), a default error message is used.
  419. [old_change_end]
  420.  
  421. -------------------------------------------------------------------------------
  422. Implementation note: The debugger need not include the test-form in the error
  423. message, and the places should not be included in the message, but they should
  424. be made available for the user's perusal. If the user gives the ``continue''
  425. command, he should be presented with the opportunity to alter the values of any
  426. or all of the references. The details of this depend on the implementation's
  427. style of user interface, of course.
  428. -------------------------------------------------------------------------------
  429.  
  430. [change_begin]
  431. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  432. Lisp Condition System. This proposal modifies the definition of assert to
  433. specify its interaction with the condition system. See section 29.4.2.
  434.  
  435. X3J13 voted in March 1988 (PUSH-EVALUATION-ORDER)   to clarify order of
  436. evaluation (see section 7.2).
  437.  
  438. X3J13 voted in June 1989 (SETF-MULTIPLE-STORE-VARIABLES)   to extend the
  439. specification of assert to allow a place whose setf method has more than one
  440. store variable (see define-setf-method).
  441. [change_end]
  442.  
  443. Examples:
  444.  
  445. (assert (valve-closed-p v1))
  446.  
  447. (assert (valve-closed-p v1) ()
  448.         "Live steam is escaping!")
  449.  
  450. (assert (valve-closed-p v1)
  451.         ((valve-manual-control v1))
  452.         "Live steam is escaping!")
  453.  
  454. ;; Note here that the user is invited to change BASE,
  455. ;; but not the bounds MINBASE and MAXBASE.
  456.  
  457. (assert (<= minbase base maxbase)
  458.         (base)
  459.         "Base ~D is not in the range ~D, ~D"
  460.         base minbase maxbase)
  461.  
  462. ;; Note here that it is probably not desirable to include the
  463. ;; entire contents of the two matrices in the error message.
  464. ;; It is reasonable to assume that the debugger will give
  465. ;; the user access to the values of the places A and B.
  466.  
  467. (assert (= (array-dimension a 1)
  468.            (array-dimension b 0))
  469.         (a b)
  470.         "Cannot multiply a ~D-by-~D matrix ~
  471.          and a ~D-by-~D matrix."
  472.         (array-dimension a 0)
  473.         (array-dimension a 1)
  474.         (array-dimension b 0)
  475.         (array-dimension b 1))
  476.  
  477. -------------------------------------------------------------------------------
  478.  
  479. 24.3. Special Forms for Exhaustive Case Analysis
  480.  
  481. The syntax for etypecase and ctypecase is the same as for typecase, except that
  482. no otherwise clause is permitted. Similarly, the syntax for ecase and ccase is
  483. the same as for case except for the otherwise clause.
  484.  
  485. etypecase and ecase are similar to typecase and case, respectively, but signal
  486. a non-continuable error rather than returning nil if no clause is selected.
  487.  
  488. ctypecase and ccase are also similar to typecase and case, but signal a
  489. continuable error if no clause is selected.
  490.  
  491. [Macro]
  492. etypecase keyform {(type {form}*)}*
  493.  
  494. [old_change_begin]
  495. This control construct is similar to typecase, but no explicit otherwise or t
  496. clause is permitted. If no clause is satisfied, etypecase signals an error with
  497. a message constructed from the clauses. It is not permissible to continue from
  498. this error. To supply an application-specific error message, the user should
  499. use typecase with an otherwise clause containing a call to error. The name of
  500. this function stands for ``exhaustive type case'' or ``error-checking type
  501. case.'' For example:
  502.  
  503. (setq x 1/3)
  504. (etypecase x
  505.   (integer x)
  506.   (symbol (symbol-value x)))
  507. Error: The value of X, 1/3, is neither
  508.        an integer nor a symbol.
  509.  
  510.  
  511. [old_change_end]
  512.  
  513. [change_begin]
  514. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  515. Lisp Condition System. This proposal modifies the definition of etypecase to
  516. specify its interaction with the condition system. See section 29.4.3.
  517. [change_end]
  518.  
  519. [Macro]
  520. ctypecase keyplace {(type {form}*)}*
  521.  
  522. [old_change_begin]
  523. This control construct is similar to typecase, but no explicit otherwise or t
  524. clause is permitted. The keyplace must be a generalized variable reference
  525. acceptable to setf. If no clause is satisfied, ctypecase signals an error with
  526. a message constructed from the clauses. Continuing from this error causes
  527. ctypecase to accept a new value from the user, store it into keyplace, and
  528. start over, making the type tests again. Subforms of keyplace may be evaluated
  529. multiple times. The name of this function stands for ``continuable exhaustive
  530. type case.''
  531. [old_change_end]
  532.  
  533. [change_begin]
  534. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  535. Lisp Condition System. This proposal modifies the definition of ctypecase to
  536. specify its interaction with the condition system. See section 29.4.3.
  537.  
  538. X3J13 voted in March 1988 (PUSH-EVALUATION-ORDER)   to clarify order of
  539. evaluation (see section 7.2).
  540. [change_end]
  541.  
  542. [Macro]
  543. ecase keyform {({({key}*) | key} {form}*)}*
  544.  
  545. [old_change_begin]
  546. This control construct is similar to case, but no explicit otherwise or t
  547. clause is permitted. If no clause is satisfied, ecase signals an error with a
  548. message constructed from the clauses. It is not permissible to continue from
  549. this error. To supply an error message, the user should use case with an
  550. otherwise clause containing a call to error. The name of this function stands
  551. for ``exhaustive case'' or ``error-checking case.'' For example:
  552.  
  553. (setq x 1/3)
  554. (ecase x
  555.   (alpha (foo))
  556.   (omega (bar))
  557.   ((zeta phi) (baz)))
  558. Error: The value of X, 1/3, is not
  559.        ALPHA, OMEGA, ZETA, or PHI.
  560.  
  561. [old_change_end]
  562.  
  563. [change_begin]
  564. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  565. Lisp Condition System. This proposal modifies the definition of ecase to
  566. specify its interaction with the condition system. See section 29.4.3.
  567. [change_end]
  568.  
  569. [Macro]
  570. ccase keyplace {({({key}*) | key} {form}*)}*
  571.  
  572. [old_change_begin]
  573. This control construct is similar to case, but no explicit otherwise or t
  574. clause is permitted. The keyplace must be a generalized variable reference
  575. acceptable to setf. If no clause is satisfied, ccase signals an error with a
  576. message constructed from the clauses. Continuing from this error causes ccase
  577. to accept a new value from the user, store it into keyplace, and start over,
  578. making the clause tests again. Subforms of keyplace may be evaluated multiple
  579. times. The name of this function stands for ``continuable exhaustive case.''
  580. [old_change_end]
  581.  
  582. [change_begin]
  583. X3J13 voted in June 1988 (CONDITION-SYSTEM)   to adopt a proposal for a Common
  584. Lisp Condition System. This proposal modifies the definition of ccase to
  585. specify its interaction with the condition system. See section 29.4.3.
  586.  
  587. X3J13 voted in March 1988 (PUSH-EVALUATION-ORDER)   to clarify order of
  588. evaluation (see section 7.2).
  589. [change_end]
  590.  
  591. -------------------------------------------------------------------------------
  592. Rationale: The special forms etypecase, ctypecase, ecase, and ccase are
  593. included in Common Lisp, even though a user could write them himself using the
  594. other standard facilities provided, because it is likely that many users will
  595. want these. Common Lisp therefore provides a standard consistent set rather
  596. than allowing a variety of incompatible dialects to develop.
  597.  
  598. In addition, experience has shown that some Lisp programmers are too lazy to
  599. put an appropriate otherwise clause into every case statement to check for
  600. cases they didn't anticipate, even if they would agree that it will probably
  601. hurt them later. If an otherwise clause can be included very easily by adding
  602. one character to the name of the construct, it is perhaps more likely that
  603. programmers will take the trouble to do it.
  604.  
  605. The e versions do nothing more than supply automatically generated otherwise
  606. clauses, but correct implementation of the c versions requires some care. It is
  607. therefore especially important that the c versions be provided by the system so
  608. users don't have to puzzle them out on their own. Individual implementations
  609. may be able to do a better job of supporting these special forms, using their
  610. own idiosyncratic facilities, than can be done using the error-signaling
  611. facilities defined by Common Lisp.
  612. -------------------------------------------------------------------------------
  613.  
  614. -------------------------------------------------------------------------------
  615.  
  616.  
  617.